<?php

namespace ANPAdmin {

   /***********************************************************
    * 
    ***********************************************************/
   class PPropertiesController extends \PRokkoMVC\PRokkoController {
      
      /***********************************************************
       *
       ***********************************************************/
      public function index(){
         $this->loadModel("ANPAdmin", "PProperty");
         $data = array(
               "Properties" => $this->model["PProperty"]->getProperties(),
               "Park" => $this->model["PProperty"]->getPark()
         );
         
         $data["totalProperties"] = count($data["Properties"]);
         
         $this->render("dashboard.tmpl", $data);
      }
      
      
      /***********************************************************
       *
       ***********************************************************/
      public function editProperty(){
         
         //
         // Being optimistic about this resource, and doing no error checking...
         //
         $id = @$_REQUEST["propertyId"];
         
         $this->loadModel("ANPAdmin", "PProperty");
         $data = array(
               "Property" => $this->model["PProperty"]->getProperty($id)
         );

         // TODO: finish this view
         $this->render("edit_property.tmpl", $data);
      }
      
      
      /***********************************************************
       *
       ***********************************************************/
      public function addProperty(){
         $this->redirect();
      }
      
      
      /***********************************************************
       * Yeah, this doesn't belong here... but it'll stay while we work
       * on a better way to load external resources...
       ***********************************************************/
      public function editPark(){
         $this->redirect();
      }
   }
}
